// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   StaffOptionScrPanel.java

package com.boci.clientapp.staffoption;

import com.boci.clientapp.main.ClientAppLoader;
import com.boci.clientapp.staffoption.action.StaffOptionAction;
import com.boci.common.constant.ClientAppConst;
import com.boci.common.ui.AbstractPanel;
import com.boci.common.util.MessagesConfigurator;
import com.boci.common.util.PerformanceLogger;
import com.boci.common.vo.ResponseVO;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Locale;
import javax.swing.*;
import javax.swing.border.EmptyBorder;

public class StaffOptionScrPanel extends AbstractPanel
{

    public StaffOptionScrPanel(Locale pLocale, String pModuleName, String pScreenName)
    {
        super(pLocale, pModuleName, pScreenName);
        initGUI();
        setText(pLocale);
    }

    public void setText(Locale pLocale)
    {
        super.setText(pLocale);
        MessagesConfigurator msgConf = ClientAppLoader.getMessagesConfigurator();
        btnHKStaffOption.setText(msgConf.getUIMessages("STAFF_OPTION.HK_STAFF_OPTION_HOLDING", pLocale));
        btnUSStaffOption.setText(msgConf.getUIMessages("STAFF_OPTION.US_STAFF_OPTION_HOLDING", pLocale));
        taDesc.setText(msgConf.getStaffOptionDesc(pLocale));
        setFont(pLocale);
        if(pLocale.equals(ClientAppConst.EN_US))
            taDesc.setWrapStyleWord(true);
        else
            taDesc.setWrapStyleWord(false);
    }

    private void setFont(Locale pLocale)
    {
        btnHKStaffOption.setFont(ClientAppLoader.getPlainButtonFont(pLocale));
        btnUSStaffOption.setFont(ClientAppLoader.getPlainButtonFont(pLocale));
        taDesc.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
    }

    private void initButtonPanel()
    {
        int intTop = 30;
        int intLeft = 0;
        int intRight = 0;
        int intBottom = 20;
        buttonPanel = new JPanel();
        buttonPanel.setBorder(new EmptyBorder(intTop, intLeft, intBottom, intRight));
        buttonPanel.setLayout(new FlowLayout(1, 30, 0));
        buttonPanel.setOpaque(false);
        btnHKStaffOption = new JButton();
        btnHKStaffOption.setActionCommand("HK_STAFF_OPTION");
        btnHKStaffOption.addActionListener(this);
        buttonPanel.add(btnHKStaffOption);
        btnUSStaffOption = new JButton();
        btnUSStaffOption.setActionCommand("US_STAFF_OPTION");
        btnUSStaffOption.addActionListener(this);
        buttonPanel.add(btnUSStaffOption);
    }

    private void initGUI()
    {
        setLayout(new BorderLayout());
        initButtonPanel();
        taDesc = new JTextArea();
        taDesc.setAutoscrolls(true);
        taDesc.setEditable(false);
        taDesc.setLineWrap(true);
        add(buttonPanel, "North");
        add(taDesc, "Center");
    }

    public void actionPerformed(ActionEvent e)
    {
        PerformanceLogger.startAppTimer();
        String strActionType = e.getActionCommand();
        StaffOptionAction staffOptionAction = new StaffOptionAction();
        staffOptionAction.doProcess(getInputValue(strActionType), strActionType);
        PerformanceLogger.stopAppTimer();
        PerformanceLogger.doLog((new StringBuilder()).append(getScreenName()).append(".").append(strActionType).toString());
    }

    public void refresh()
    {
        SwingUtilities.invokeLater(new Runnable() {

            public void run()
            {
                btnHKStaffOption.requestFocus();
            }
        }
);
    }

    public void refresh(ResponseVO responsevo)
    {
    }

    public HashMap getInputValue(String pActionType)
    {
        return null;
    }

    public boolean validate(String pActionType)
    {
        return true;
    }

    public void setDefFocus()
    {
        SwingUtilities.invokeLater(new Runnable() {

            public void run()
            {
                btnHKStaffOption.requestFocus();
            }
        }
);
    }

    private JButton btnHKStaffOption;
    private JButton btnUSStaffOption;
    private JPanel buttonPanel;
    private JTextArea taDesc;

}
